/*
 * uart_slave_reg.c
 *
 *  Created on: Jun 2, 2025
 *      Author: lsy18
 */

#include "uart_slave_reg.h"

uint8_t reg_array[256];

void uart_slave_reg_init()
{
	reg_array[MODE_REG] = time_mode;
	reg_array[TIME_INT_REG] = 0x32;
	reg_array[REGISTER_STAR_REG] = 0x04;
	reg_array[REGISTER_NUM_REG] = 0x0A;
	reg_array[PWM_LEFT_L_REG] = 0xDC;
	reg_array[PWM_LEFT_H_REG] = 0x05;
	reg_array[PWM_RIGHT_L_REG] = 0xDC;
	reg_array[PWM_RIGHT_H_REG] = 0x05;
}

void uart_slave_reg_write(uint8_t *data , REG_adress adress , uint8_t reg_num)
{
	for(uint8_t i=0; i<reg_num; i++)
	{
	reg_array[adress +i] = data[i];
	}
}

void uart_slave_reg_read(uint8_t *data , REG_adress adress , uint8_t reg_num)
{
	for(uint8_t i=0; i<= reg_num; i++)
	{
	data[i] = reg_array[adress +i];
	}
}
